package com.luhuiguo.cms.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

import com.luhuiguo.gwt.dispatcher.server.ActionHandlerRegistry;
import com.luhuiguo.gwt.dispatcher.server.Dispatcher;
import com.luhuiguo.gwt.dispatcher.server.spring.SpringActionHandlerRegistry;
import com.luhuiguo.gwt.dispatcher.server.spring.SpringDispatcher;

/**
 * The spring java-based configuration for the application.
 * 
 * @author LuHuiguo
 * @version $Id: AppConfig.java 174 2010-05-16 14:32:19Z luhuiguo@gmail.com $
 */
@Configuration
@Import({ JpaConfig.class, ServiceConfig.class, HandlerConfig.class })
@ImportResource("classpath:security-config.xml")
public class AppConfig {

    @Bean
    public ActionHandlerRegistry actionHandlerRegistry() {
        return new SpringActionHandlerRegistry();
    }

    @Bean
    public Dispatcher springDispatcher() {
        return new SpringDispatcher(actionHandlerRegistry());
    }

}
